package com.mmlc.meimei.lichengkongjian.Adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.androidnetframe.BaseParentActivity;
import com.mmlc.meimei.lichengkongjian.App;
import com.mmlc.meimei.lichengkongjian.R;
import com.mmlc.meimei.lichengkongjian.been.RefundListBean;
import com.mmlc.meimei.lichengkongjian.customview.MuchOrderItemGroup;

import java.util.List;


public class RefundListAdapter extends BaseAdapter{

    ViewGroup viewGroup;
    List<RefundListBean> item;
    public BaseParentActivity activity;
    public RefundListAdapter(ViewGroup viewGroup, List<RefundListBean> item, BaseParentActivity activity){
        this.viewGroup = viewGroup;
        this.item = item;
        this.activity = activity;
    }

    @Override
    public int getCount() {
        return item.size();
    }

    @Override
    public Object getItem(int i) {
        return item.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(final int position, View view, ViewGroup viewGroup) {
        RefundListBean bean = item.get(position);
        if(view == null){
            view = App.layoutInflater.inflate( R.layout.adapter_order_much3,viewGroup,false);
        }

        TextView tv_orderNumber = (TextView)view.findViewById(R.id.tv_orderNumber);
        tv_orderNumber.setText(bean.orderId);

        TextView tv_orderState = (TextView)view.findViewById(R.id.tv_orderState);
        tv_orderState.setText(bean.orderState);

        TextView tv_allShopCount = (TextView)view.findViewById(R.id.tv_allShopCount);
        tv_allShopCount.setText("产品总价: ¥"+bean.allShopPrice);

        MuchOrderItemGroup mg_itemGroup = (MuchOrderItemGroup) view.findViewById(R.id.mg_itemGroup);
        mg_itemGroup.addRefundItem(bean.itemBeenList);

        return view;
    }
}

